home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_1828.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  1.1 KB  |  17 lines

  1. That is a bug in cfront 2.1.  There is a magic variable, __builtin_va_alist. It has to be added to the end of the argument list of a varadic function, and it has to be referenced in va_start.  This requires source modification to (a) print ',__builtin_va_alist' on the end of the argument list, (b) pretend that this arg was declared, and thus pass references to it, and (c) not mangle its name in the process.
  2.  
  3. Here's a tiny bit more detail:
  4. 1) when print2.c prints a varadic procedure, it should add __builtin_va_alist    to the end. It need not declare it. Type of int to the Sun C compiler (the    default) is fine.
  5. 2) #define   va_start(ap,parmN)   ap = (char *)&__builtin_va_alist
  6. 3) when find.c see this reference to __builtin_va_alist, it should construct a    special cfront name node. When name::print sees that node it should print    its name literally, without adding any mangling.
  7. 4) the same trick is needed, with the name va_alist, for Ultrix/MIPS and HPUX.
  8. 5) the net result, in generated C code, looks like:
  9.     void var_proc (a, b, c, __builtin_va_alist)
  10.       int a;
  11.       float b;
  12.       char * c;
  13.     {
  14.         char * val;
  15.         val = &__builtin_va_alist;
  16.         ...
  17.     }